package com.xbongbong.paas.service;

import com.xbongbong.paas.pojo.workflow.BeforeOperatorPojo;
import com.xbongbong.paas.pojo.workflow.operate.dto.WorkflowAddSignatureDTO;
import com.xbongbong.paas.pojo.workflow.operate.dto.WorkflowCommitDTO;
import com.xbongbong.paas.pojo.workflow.operate.dto.WorkflowStorageDTO;
import com.xbongbong.paas.pojo.workflow.operate.dto.WorkflowTransferDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.workflow.domain.entity.WorkflowNodeEntity;
import com.xbongbong.workflow.domain.entity.WorkflowTaskNodeEntity;
import com.xbongbong.workflow.domain.entity.WorkflowTransferDataEntity;
import com.xbongbong.workflow.pojo.WorkflowTransferPOJO;

import java.util.List;

/**
 * 审批节点操作接口
 * @author 魏荣杰
 *
 */
public interface WorkflowApprovalOperate {

    /**
     * Description: 提交操作
     * @param workflowCommitDTO
     * @param taskNodeEntity
     * @param beforeOperatorPojo
     * @return void
     * @throws XbbException
     * @author 魏荣杰
     * @date 2021/5/25 09:54
     * @since
     */
    void commit(WorkflowCommitDTO workflowCommitDTO, WorkflowTaskNodeEntity taskNodeEntity, BeforeOperatorPojo beforeOperatorPojo, WorkflowTransferDataEntity workflowTransferDataEntity) throws XbbException;

    /**
     * Description: 结束流程/拒绝流程
     * @param
     * @param taskNodeEntity
     * @param autoRefuse 是否系统自动拒绝
     * @param workflowTransferPOJO 上下文
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2021/5/25 09:55
     * @since
     */
    void refuse(WorkflowTaskNodeEntity taskNodeEntity, boolean autoRefuse, WorkflowTransferPOJO workflowTransferPOJO, UserVO userVO) throws XbbException;

    /**
     * Description: 暂存
     * @param workflowStorageDTO 流转中的数据
     * @param workflowTaskNodeEntity 模板节点
     * @param beforeOperatorPojo 暂存的新数据
     * @return void
     * @throws XbbException
     * @author 魏荣杰
     * @date 2021/5/25 09:55
     * @since
     */
    void storage(WorkflowStorageDTO workflowStorageDTO, WorkflowTaskNodeEntity workflowTaskNodeEntity, BeforeOperatorPojo beforeOperatorPojo, WorkflowTransferDataEntity workflowTransferDataEntity) throws XbbException;

    /**
     * Description: 转交
     * @param workflowTransferDTO
     * @param taskNodeEntity
     * @param transferUserId
     * @param beforeOperatorPojo
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2021/5/25 10:30
     * @since
     */
    void transfer(WorkflowTransferDTO workflowTransferDTO, WorkflowTaskNodeEntity taskNodeEntity, String transferUserId, BeforeOperatorPojo beforeOperatorPojo, WorkflowTransferDataEntity workflowTransferDataEntity) throws XbbException;

    /**
     * Description: 回退
     * @param
     * @param workflowTaskNodeEntity
     * @param operatorId 审批操作人
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2021/5/25 10:33
     * @since
     */
    void back(WorkflowTaskNodeEntity workflowTaskNodeEntity, String operatorId, WorkflowNodeEntity lastNode) throws XbbException;

    /**
     * Description: 撤回
     * @param
     * @param taskNodeEntity
     * @param revokeUserId
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2021/5/25 10:33
     * @since
     */
    void revoke(WorkflowTaskNodeEntity taskNodeEntity, String revokeUserId, UserVO userVO) throws XbbException;

    /**
     * 更新数据和上下文表中的数据
     * @param workflowTransferPOJO
     * @param taskNodeEntity
     * @param beforeOperatorPojo
     * @param userVO
     * @param workflowTransferDataEntity
     * @throws XbbException
     */
    void update(WorkflowTransferPOJO workflowTransferPOJO, WorkflowTaskNodeEntity taskNodeEntity, BeforeOperatorPojo beforeOperatorPojo, UserVO userVO, WorkflowTransferDataEntity workflowTransferDataEntity) throws XbbException;

    /**
     * 更新数据和上下文表中的数据
     * @param workflowTransferPOJO
     * @param taskNodeEntity
     * @param beforeOperatorPojo
     * @param userVO
     * @throws XbbException
     */
    void updateData(WorkflowTransferPOJO workflowTransferPOJO, WorkflowTaskNodeEntity taskNodeEntity, BeforeOperatorPojo beforeOperatorPojo, UserVO userVO,Integer TaskType) throws XbbException;

    /**
     * Description: 创建钉钉待办任务
     * @param workflowTaskNodeEntityList
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2022/1/6 18:02
     * @since
     */
    void createDingtalkTodoTask(List<WorkflowTaskNodeEntity> workflowTaskNodeEntityList);


    /**
     * Description: 加签
     *
     * @param workflowAddSignatureDTO
     * @param workflowTaskNodeEntity
     * @param nowTaskNodeList
     * @return void
     * @throws
     * @author 魏荣杰
     * @date 2022/7/13 16:26
     * @since
     */
    void addSignature(WorkflowAddSignatureDTO workflowAddSignatureDTO, WorkflowTaskNodeEntity workflowTaskNodeEntity, List<WorkflowTaskNodeEntity> nowTaskNodeList) throws XbbException;
}
